<extend name="Public/common" />
<block name="body">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>服务器管理</h5>
                        <h5 style="float: right;"><a href="javascript:location.reload();"><i class="fa fa-refresh"></i></a></h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">

                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th>id</th>
                                    <th>大区服务器</th>
                                    <th>小区服务器</th>
                                    <th>开服时间</th>
                                    <th>数据库名称</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="arr" id="v">
                                    <tr>
                                        <td>{$v.id}</td>
                                        <td>{$v.pid|daqu}</td>
                                        <td>{$v.name}</td>
                                        <td>{$v.etime}</td>
                                        <td>{$v.database}</td>
                                        <td>
                                            <if condition="$v.state eq 1">
                                                被删
                                                <else/>
                                                正常
                                            </if>
                                        </td>
                                        <td>
                                            <a class="db" href="{:U('Database/xiu',['time'=>$data['time']])}?id={$v.id}"><button type="button"  id="xiu" class="btn btn-outline btn-primary btn-xs">修改</button></a>
                                            <a href="{:U('Database/del2',['time'=>$data['time']])}?id={$v.id}" class="ajax-delete"><button type="button" class="btn btn-outline btn-default btn-xs">删除</button></a>
                                        </td>
                                    </tr>
                                </volist>
                                </tbody>
                            </table>
                        </div>
                        <form action='__APP__/database/data' method='post' id='form'>
                            <div class="ibox-title">
                                <h5>添加服务器</h5>
                                <h5 style="float: right;"><a href="javascript:location.reload();"><i class="fa fa-refresh"></i></a></h5>
                            </div>
                            <div class="ibox-content">
                                <div class="form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">服务器名称：</label>

                                        <div class="col-sm-10">
                                            <input type='text' class="form-control" name='name'/>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">所属服务器：</label>

                                        <div class="col-sm-10">
                                            <select name='servers' class="form-control">
                                                <option value='0' selected></option>
                                                <volist name='arr2' id='v2'>
                                                    <option value='{$v2.id}'>{$v2.name}</option>
                                                </volist>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <!--<div class="form-group">-->
                                        <!--<label class="col-sm-2 control-label">数据库名称：</label>-->

                                        <!--<div class="col-sm-10">-->
                                            <!--<input type='text' class="form-control" name='database' />-->
                                        <!--</div>-->
                                    <!--</div>-->
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <input type="submit" value="添加" class="btn btn-primary" id="save">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <div align="center" id="div_tian"><input class="btn btn-outline btn-info btn-xs" id="tianjia" type="button" value="添加"></div>
                        <div style="text-align: center;">{$page}</div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <style>
        #form{
            display: none;
        }
    </style>
    <script type="text/javascript">
        var a=0;
        $("#tianjia").click(function () {
            a++
            if(a==2){
                $("#tianjia").attr("value","添加");
                a=0
                $('#form').hide();
            }else{
                $("#div_tian").attr("align","center");
                $("#tianjia").attr("value","取消");
                $('#form').show();
            }
        });
    </script>
</block>